package com.example.common;

/**
 * @BelongsProject: pms
 * @BelongsPackage: com.wh.common
 * @Author: LJ
 * @CreateTime: 2020-07-16 20:45
 * @Description:
 */
public class TableServerResponse<T> {
    private Integer code;//状态码
    private T data;//数据
    private Long count;//数据的总条数

    public TableServerResponse() {
    }

    public TableServerResponse(Integer code, T data) {
        this.code = code;
        this.data = data;
    }

    public TableServerResponse(Integer code, T data, Long count) {
        this.code = code;
        this.data = data;
        this.count = count;
    }

    public static <T> TableServerResponse createSuccess(Integer code, T data, Long count){
        return new TableServerResponse(code,data,count);
    }
    public static <T> TableServerResponse createSuccess( T data){
        return new TableServerResponse(0,data);
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public Long getCount() {
        return count;
    }

    public void setCount(Long count) {
        this.count = count;
    }

    @Override
    public String toString() {
        return "TableServerResponse{" +
                "code=" + code +
                ", data=" + data +
                ", count=" + count +
                '}';
    }
}

